/*---------------*/
/* Joseph Porter */
/* Summer of 2012*/
/* Team 1247     */
/*www.ROKSBOT.com*/
/* Joystick      */
/*---------------*/
package Team1247Classes.Input;

import edu.wpi.first.wpilibj.Joystick;

public class JoystickHandler {
    public Joystick joystick;
    private boolean buttons_return[];
    private double axis_return[];
    public JoystickHandler(int usbPort){
        joystick = new Joystick (usbPort);
    }
    
    public boolean[] getButtons(){
        for(int button=1;button<12;button++){
            this.buttons_return[button+1]=joystick.getRawButton(button);          
        }               
         return this.buttons_return;
    }
    
    public double[] getAxis(double deadzone){
        for(int axis=1;axis<6;axis++){
            this.axis_return[axis+1]=joystick.getRawAxis(axis);
            if(deadzone !=0){
                if(this.axis_return[axis+1]<deadzone){
                    this.axis_return[axis+1]=0;
                }
            }
        }
        
        return this.axis_return;
    }
}
